package com.kedi.welfarecenter.read.dao.mapper;

import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
* @Description:    社区养老保障
* @Author:         ytw
* @CreateDate:     2019/7/23 15:33
* @UpdateRemark:   修改内容
* @Version:        1.0
*/
@Mapper
public interface CommunityPenSecurityMapper {

    /**
    * 方法实现说明  查找所有社区养老保障 默认type=1
    * @author      ytw
    *@param
    * @return
    * @exception
    * @date        2019/7/23 17:07
    */
    @Select("select welfare_id,welfare_title,name,low_age,heigh_age,price,status,givetime from welfare where type=1")
    List<Map<String,Object>> selectcps();

    /**
    * 方法实现说明  根据福利名称查找社区养老保障
    * @author      ytw
    *@param   welfaretitle
    * @return
    * @exception
    * @date        2019/7/23 17:10
    */
    @Select("select welfare_id,welfare_title,name,low_age,heigh_age,price,status,givetime from welfare where welfare_title=#{welfare_title} and type=1")
    List<Map<String,Object>> selectcpsByName(@Param("welfare_title")String welfaretitle);

    /**
    * 方法实现说明  根据福利主键id查详情
    * @author      ytw
    *@param   welfareId
    * @return
    * @exception
    * @date        2019/7/24 10:43
    */
    @Select("select welfare.welfare_title,welfare_receiver.status,welfare_receiver.welfare_receiver_id,welfare_receiver.welfare_receiver,welfare_receiver.idcard,welfare_receiver.receiv_time,welfare_receiver.phone\n" +
            "from welfare_receiver left join welfare on welfare.welfare_id = welfare_receiver.welfare_id where welfare.welfare_id=#{welfare_id}")
    List<Map<String,Object>> selectcpsDetails(@Param("welfare_id")Integer welfareId);

    /**
    * 方法实现说明  上门慰问  返回领取人电话
    * @author      ytw
    *@param     welfarereceiverid
    * @return
    * @exception
    * @date        2019/7/24 10:50
    */
    @Select("select welfare_receiver.phone from welfare_receiver where welfare_receiver_id=#{welfare_receiver_id}")
    Map<String,Object> selectcpsPhone(@Param("welfare_receiver_id") Integer welfarereceiverid);

}
